
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>H+ 后台主题UI框架 - 字体图标</title>
    <link rel="shortcut icon" href="favicon.ico"> <link href="static/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="static/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">

    <link href="static/css/animate.min.css" rel="stylesheet">
    <link href="static/css/style.min.css?v=4.0.0" rel="stylesheet"><base target="_blank">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-3">
        </div>
        <div class="col-sm-9">
            <div class="ibox float-e-margins">
                <div class="ibox-content icons-box">
                    <form action="" id="tijiao" onsubmit="return jump();" method="post">
                        <!-- 正文区域 -->
                        <section class="content"> <!--产品信息-->

                            <div class="panel panel-default">
                                <div class="panel-heading">材料填写</div>
                               <input type="hidden" name="pstate" value="待受理">
                                <div class="row data-type">
                                    <div class="col-md-2 title" style="top: 10px;left: 20px">项目名称</div>
                                    <div class="col-md-4 data">
                                        <input type="text" class="form-control" name="pname" id="pname">
                                    </div>

                                    <div class="col-md-2 title"style="top: 10px;left: 20px">项目编码</div>
                                    <div class="col-md-4 data">
                                        <input type="text" class="form-control" name="pcode" id="pcode">
                                    </div>

                                    <div class="col-md-2 title"style="top: 10px;left: 20px">申报单位</div>
                                    <div class="col-md-4 data">
                                        <input type="text" class="form-control" name="punit" id="punit">
                                    </div>

                                    <div class="col-md-2 title"style="top: 10px;left: 20px">实施单位</div>
                                    <div class="col-md-4 data">
                                        <input type="text" class="form-control" name="piunit" id="piunit" >
                                    </div>

                                    <div class="col-md-2 title"style="top: 10px;left: 20px">负责人</div>
                                    <div class="col-md-4 data">
                                        <input type="text" class="form-control" name="pdirector" id="pdirector" >
                                    </div>

                                    <div class="col-md-2 title"style="top: 10px;left: 20px">联系电话</div>
                                    <div class="col-md-4 data">
                                        <input type="text" class="form-control" name="pphone" id="pphone" >
                                    </div>

                                    <div class="col-md-2 title"style="top: 10px;left: 20px">邮政编码</div>
                                    <div class="col-md-4 data">
                                        <input type="text" class="form-control" name="ppostcode" id="ppostcode" >
                                    </div>

                                    <div class="col-md-2 title"style="top: 10px;left: 20px">项目级次</div>
                                    <div class="col-md-4 data">
                                        <select class="form-control select2 select2-hidden-accessible" name="pgrade" tabindex="-1" aria-hidden="true">
                                            <option value="一级" selected="selected">一级</option>
                                            <option value="二级">二级</option>
                                            <option value="三级">三级</option>
                                        </select>
                                        <span class="select2 select2-container select2-container--default" dir="ltr" style="width: 306px;">
                                        <span class="selection"><span class="select2-selection select2-selection--single" role="combobox" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-labelledby="select2-itemLevel-zb-container">
                                            <span class="select2-selection__rendered" id="select2-itemLevel-zb-container" title="一级"></span>
                                            <span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>
                                        </span>
                                        </span>
                                        <span class="dropdown-wrapper" aria-hidden="true"></span>
                                    </span>
                                    </div>

                                    <div class="col-md-2 title"style="top: 10px;left: 20px">项目类型</div>
                                    <div class="col-md-4 data">
                                        <select class="form-control select2 select2-hidden-accessible" name="ptype" tabindex="-1" aria-hidden="true">
                                            <option value="新材料" selected="selected">新材料</option>
                                            <option value="电子信息">电子信息</option>
                                            <option value="高技术服务">高技术服务</option>
                                            <option value="资源与环境">资源与环境</option>
                                            <option value="生物与新医药">生物与新医药</option>
                                            <option value="新能源与节能">新能源与节能</option>
                                            <option value="先进制造与自动化">先进制造与自动化</option>
                                            <option value=""></option>
                                        </select>
                                        <span class="select2 select2-container select2-container--default" dir="ltr" style="width: 306px;">
                                            <span class="selection"><span class="select2-selection select2-selection--single" role="combobox" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-labelledby="select2-projectType-aw-container">
                                                <span class="select2-selection__rendered" id="select2-projectType-aw-container" title="新材料"></span>
                                                <span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>
                                            </span>
                                            </span>
                                            <span class="dropdown-wrapper" aria-hidden="true">
                                            </span>
                                        </span>
                                    </div>

                                    <div class="col-md-2 title"style="top: 10px;left: 20px">项目属性</div>
                                    <div class="col-md-4 data">
                                        <select class="form-control select2 select2-hidden-accessible" name="pattribute" tabindex="-1" aria-hidden="true">
                                            <option value="一期" selected="selected">一期</option>
                                            <option value="二期">二期</option>
                                            <option value="三期">三期</option>
                                        </select><span class="select2 select2-container select2-container--default" dir="ltr" style="width: 306px;">
                                        <span class="selection">
                                            <span class="select2-selection select2-selection--single" role="combobox" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-labelledby="select2-projectPro-a1-container">
                                            <span class="select2-selection__rendered" id="select2-projectPro-a1-container" title="一期"></span>
                                                <span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>
                                            </span>
                                        </span>
                                        <span class="dropdown-wrapper" aria-hidden="true"></span>
                                    </span>
                                    </div>

                                    <div class="col-md-2 title"style="top: 10px;left: 20px">项目组主要成员</div>
                                    <div class="col-md-4 data">
                                        <input type="text" class="form-control" name="pperson" id="pperson">
                                    </div>


                                    <div class="col-md-2 title"style="top: 10px;left: 20px">起始时间</div>
                                    <div class="col-md-4 data">
                                        <div class="input-group date">
                                            <input type="date" class="form-control pull-right" id="psdate-1" autocomplete="off" name="psdate">
                                        </div>
                                    </div>

                                    <div class="col-md-2 title"style="top: 10px;left: 20px">终止时间</div>
                                    <div class="col-md-4 data">
                                        <div class="input-group date">
                                            <input type="date" class="form-control pull-right" id="ptdate-1" autocomplete="off" name="ptdate">
                                        </div>
                                    </div>

                                    <div class="col-md-2 title"style="top: 10px;left: 20px">申报时间</div>
                                    <div class="col-md-4 data">
                                        <div class="input-group date">
                                            <input type="date" class="form-control pull-right" id="pddate-1" autocomplete="off" name="pddate">
                                        </div>
                                    </div>

                                    <div class="col-md-2 title"style="top: 10px;left: 20px">项目预算</div>
                                    <div class="col-md-4 data">
                                        <input type="text" class="form-control" name="pbudget" id="pbudget">
                                    </div>

                                    <div class="col-md-2 title rowHeight2x"style="top: 10px;left: 20px">项目申请理由</div>
                                    <div class="col-md-10 data rowHeight2x">
                                        <textarea class="form-control" rows="3" placeholder="项目申请理由" id="preson" name="preson" ></textarea>
                                    </div>
                                </div>
                            </div>
                            <div class="box-tools text-center">
                                <button type="submit" class="btn bg-maroon">申报</button>
                                <button type="button" class="btn bg-default" onclick="history.back(-1);">返回</button>
                            </div>
                            <!--工具栏/--> </section>
                        <!-- 正文区域 /-->
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="static/js/jquery.min.js?v=2.1.4"></script>
<script src="static/js/bootstrap.min.js?v=3.3.5"></script>
<script src="static/js/content.min.js?v=1.0.0"></script>
<script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>


<script>
    //项目名称不能为空
    function checkpname() {
        //获取姓名的值
        var pname = $("#pname").val();
        // 定义正则的表达
        //中英文名字正则
        var reg_pname= /\S/;
        //判断
        var flag = reg_pname.test(pname);
        if (flag) {
            //名字合法
            $("#pname").css("border", "");
        } else {
            $("#pname").css("border", "1px solid red")
        }
        return flag;
    }

    //项目编码不能为空
    function checkpcode() {
        //获取姓名的值
        var pcode = $("#pcode").val();
        // 定义正则的表达
        //中英文名字正则
        var reg_pcode= /^[0-9]*$/;
        var reg_pcodeNull= /\S/;
        //判断
        var flag = reg_pcode.test(pcode);
        var flagNull = reg_pcodeNull.test(pcode);
        if (flag&&flagNull) {
            //名字合法
            $("#pcode").css("border", "");
        } else {
            $("#pcode").css("border", "1px solid red")
        }
        return flag&&flagNull;
    }

    //申报单位不能为空
    function checkpunit() {
        //获取姓名的值
        var punit = $("#punit").val();
        // 定义正则的表达
        //中英文名字正则
        var reg_punit= /\S/;
        //判断
        var flag = reg_punit.test(punit);
        if (flag) {
            //名字合法
            $("#punit").css("border", "");
        } else {
            $("#punit").css("border", "1px solid red")
        }
        return flag;
    }

    //实施单位不能为空
    function checkpiunit() {
        //获取姓名的值imUnit
        var piunit = $("#piunit").val();
        // 定义正则的表达
        //中英文名字正则
        var reg_piunit= /\S/;
        //判断
        var flag = reg_piunit.test(piunit);
        if (flag) {
            //名字合法
            $("#piunit").css("border", "");
        } else {
            $("#piunit").css("border", "1px solid red")
        }
        return flag;
    }

    //负责人不能为空
    //4.姓名：非空
    function checkpdirector() {
        //获取姓名的值
        var name = $("#pdirector").val();
        // 定义正则的表达
        //中英文名字正则
        var reg_cname = /^[\u4E00-\u9FA5A-Za-z\s]+(·[\u4E00-\u9FA5A-Za-z]+)*$/;
        //判断
        var flag = reg_cname.test(name);
        if (flag) {
            //名字合法
            $("#pdirector").css("border", "");
        } else {
            $("#pdirector").css("border", "1px solid red")
        }
        return flag;
    }

    //联系电话不能为空
    // 手机号：手机号格式
    function checkpphone() {
        //1.获取邮箱
        var telephone = $("#pphone").val();
        //2.定义正则 格式  itcat@163.com
        var reg_telephone = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
        //3.判断
        var flag = reg_telephone.test(telephone);
        if (flag) {
            //telephone 格式合法
            $("#pphone").css("border", "");
        } else {
            //telephone 格式不合法
            $("#pphone").css("border", "1px solid red");
        }
        return flag;
    }

    //邮政编码不能为空
    function checkppostcode() {
        //获取姓名的值imUnit
        var ppostcode = $("#ppostcode").val();
        // 定义正则的表达
        //中英文名字正则
        var reg_ppostcode= /^[0-9]{6}$/;
        //判断
        var flag = reg_ppostcode.test(ppostcode);
        if (flag) {
            //名字合法
            $("#ppostcode").css("border", "");
        } else {
            $("#ppostcode").css("border", "1px solid red")
        }
        return flag;
    }

    //项目主要成员不能为空
    function checkpperson() {
        //获取姓名的值imUnit
        var pperson = $("#pperson").val();
        // 定义正则的表达
        //中英文名字正则
        var reg_pperson= /\S/;
        //判断
        var flag = reg_pperson.test(pperson);
        if (flag) {
            //名字合法
            $("#pperson").css("border", "");
        } else {
            $("#pperson").css("border", "1px solid red")
        }
        return flag;
    }

    //项目开始时间不能为空
    function checkpsdate() {
        //获取姓名的值imUnit
        var psdate = $("#psdate-1").val();
        // 定义正则的表达
        //中英文名字正则
        var reg_psdate= /\S/;
        //判断
        var flag = reg_psdate.test(psdate);
        if (flag) {
            //名字合法
            $("#psdate-a1").css("border", "");
        } else {
            $("#psdater-a1").css("border", "1px solid red")
        }
        return flag;
    }

    //项目终止时间不能为空
    function checkptdate() {
        //获取姓名的值imUnit
        var ptdate = $("#ptdate-1").val();
        // 定义正则的表达
        //中英文名字正则
        var reg_ptdate= /\S/;
        //判断
        var flag = reg_ptdate.test(ptdate);
        if (flag) {
            //名字合法
            $("#ptdate-1").css("border", "");
        } else {
            $("#ptdate-1").css("border", "1px solid red")
        }
        return flag;
    }

    //项目申请时间不能为空
    function checkpddate() {
        //获取姓名的值imUnit
        var pddate = $("#pddate-1").val();
        // 定义正则的表达
        //中英文名字正则
        var reg_pddate= /\S/;
        //判断
        var flag = reg_pddate.test(pddate);
        if (flag) {
            //名字合法
            $("#pddate-1").css("border", "");
        } else {
            $("#pddate-1").css("border", "1px solid red")
        }
        return flag;
    }

    //项目预算不能为空
    function checkpbudget() {
        //获取姓名的值imUnit
        var pbudget = $("#pbudget").val();
        // 定义正则的表达
        //中英文名字正则
        var reg_pbudget=/^[0-9]*$/;
        var reg_pbudgetNull=/\S/;
        //判断
        var flag = reg_pbudget.test(pbudget);
        var flagNull = reg_pbudgetNull.test(pbudget);
        if (flag&&flagNull) {
            //名字合法
            $("#pbudget").css("border", "");
        } else {
            $("#pbudget").css("border", "1px solid red")
        }
        return flag&&flagNull;
    }

    //项目申请理由不能为空
    function checkpreson() {
        //获取姓名的值imUnit
        var preson = $("#preson").val();
        // 定义正则的表达
        //中英文名字正则
        var reg_preson= /\S/;
        //判断
        var flag = reg_preson.test(preson);
        if (flag) {
            //名字合法
            $("#preson").css("border", "");
        } else {
            $("#preson").css("border", "1px solid red")
        }
        return flag;
    }

    $(function () {
        $("#pname").blur(function () {
            checkpname();
        });
        $("#pcode").blur(function (){
            checkpcode();
        });
        $("#punit").blur(function (){
            checkpunit();
        });
        $("#piunit").blur(function (){
            checkpiunit();
        });
        $("#pdirector").blur(function (){
            checkpdirector();
        });
        $("#pphone").blur(function (){
            checkpphone();
        });
        $("#ppostcode").blur(function (){
            checkppostcode();
        });
        $("#pperson").blur(function (){
            checkpperson();
        });
        $("#psdate-1").blur(function (){
            checkpsdate();
        });
        $("#ptdate-1").blur(function (){
            checkptdate();
        });
        $("#pddate-1").blur(function (){
            checkpddate();
        });
        $("#pbudget").blur(function (){
            checkpbudget();
        });
        $("#preson").blur(function (){
            checkpreson();
        });
    });

    //当表提交时，调用所有的校验方法
    function jump() {
        //1.发送数据到服务器
        if (checkpname() && checkpcode()&&checkpunit()&&checkpiunit()&&checkpdirector() &&checkpphone()&&checkppostcode()&&checkpperson()&&checkpsdate() &&checkptdate()&&checkpddate()&&checkpbudget()&&checkpreson()) {
            $("#tijiao").attr("action","addproject");
            return true;
        }else {
            alert("信息有误，请重新填写");
            return false;
        }
    }


</script>
</body>

</html>